package com.liu.seckill.controller;

import com.liu.seckill.pojo.User;
import com.liu.seckill.service.IOrderService;
import com.liu.seckill.vo.OrderDetailVo;
import com.liu.seckill.vo.RespBean;
import com.liu.seckill.vo.RespBeanEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @ClassName OrderController
 * @Author ：name
 * @Date ：2022-02-17 15:40
 * @Description：
 * @Version: 1.0
 */

@Controller
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private IOrderService orderService;

    /**
      * 订单详情
      * @param user
      * @param orderId
      * @return
      */
  @RequestMapping("/detail")
  @ResponseBody
  public RespBean detail(User user, Long orderId){

      if (null==user){
     return RespBean.error(RespBeanEnum.SESSION_ERROR);
   }

  OrderDetailVo detail = orderService.detail(orderId);
   return RespBean.success(detail);}




    @RequestMapping("/orderDetail")
    public String detail(){

      return "orderDetail";

    }



}
